<template>
<div>
  <AppHeader/>
  <div class="countryFrom">
    <el-form ref="form" :model="countryFrom" label-width="80px">
      <el-form-item label-width="110px" size="medium" label="所在国家">
<!--        <el-cascader-->
<!--            size="large"-->
<!--            :options="options"-->
<!--            v-model="selectedOptions"-->
<!--            @change="handleChange"-->
<!--        >-->
<!--        </el-cascader>-->
        <el-input v-model="countryFrom.country"></el-input>
      </el-form-item>
      <el-form-item label-width="110px" size="medium" label="新增确诊">
        <el-input v-model="countryFrom.addnumber"></el-input>
      </el-form-item>
      <el-form-item label-width="110px" size="medium" label="新增死亡">
        <el-input v-model="countryFrom.add_die"></el-input>
      </el-form-item>
      <el-form-item label-width="110px" size="medium"  label="新增无症状">
        <el-input v-model="countryFrom.addnosym"></el-input>
      </el-form-item>
      <el-form-item label-width="110px" size="medium" label="填报时间">
        <el-col :span="15">
          <el-date-picker type="date" placeholder="选择日期" v-model="countryFrom.date" format="yyyy 年 MM 月 dd 日"
                          value-format="yyyy-MM-dd" style="width: 100%;"></el-date-picker>
        </el-col>
<!--        <el-col class="line" :span="2">-</el-col>-->
<!--        <el-col :span="11">-->
<!--          <el-time-picker placeholder="选择时间" v-model="countryFrom.date2" style="width: 100%;"></el-time-picker>-->
<!--        </el-col>-->
      </el-form-item>
      <el-form-item label-width="110px" size="medium" label="其他情况">
        <el-input type="textarea" v-model="countryFrom.descinfor"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">立即提交</el-button>
        <el-button @click="reset">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</div>
</template>

<script>
import {addCountryData} from "@/request";
import AppHeader from "@/components/AppHeader.vue";
export default {
  name: "addCountryData",
  components:{
    AppHeader
  },
  data(){
    return{
      countryFrom:{
        country:'',
        addnumber: '',
        add_die: '',
        addnosym:'',
        date:'',
        descinfor:'',
      }
    }
  },
  methods:{
    onSubmit() {
      addCountryData(this.countryFrom)
          .then((res)=>{
            console.log("输出数据：" + res.data.data)
            console.log("输出数据：" + res.data.msg)
            console.log("输出数据：" + res.data.code)
            if(res.data.code===200){
              this.$message({
                message:'国家级疫情数据填报成功',
                type:"success",
                showClose:true
              })
            }else{
              this.$message({
                message:'国家级疫情数据填报失败',
                type:'error',
                showClose:true
              })
            }
          })
          .catch((err)=>{
            this.$message({
              message:'${err}',
              type:'error',
              showClose:true
            })
          })
    },
    reset(){
      this.countryFrom={}
    }
  }
}
</script>

<style scoped>
.countryFrom{
  width: 500px;
  margin-top: 40px;
  margin-left: 40px;
}

</style>